<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>立即消费</title>
<!--公共样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/reset.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/common.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome.min.css">
<!--公共样式结束-->
<!--页面样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/module_form.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/page_nowxf.css">
<!--页面样式结束--
<!--公共JS开始-->
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.min.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.timer.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/common.js"></script>
<!--公共JS结束-->
<!--数据列表插件开始-->
<link href="{$NOW_THEME_URL}/Assets/Plugins/ContextMenu/src/jquery.contextMenu.css" rel="stylesheet" type="text/css" />
<script src="{$NOW_THEME_URL}/Assets/Plugins/ContextMenu/src/jquery.ui.position.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Plugins/ContextMenu/src/jquery.contextMenu.js"></script>
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/Etgrid/Css/etgrid.css">
<script src="{$NOW_THEME_URL}/Assets/Plugins/Etgrid/Js/etgrid.js"></script>
<!--数据列表插件结束-->
<style type="text/css">
	body {
		overflow:hidden;
	}
</style>
</head>

<body>
	<div class="yhlist clearfix">
		<div class="table_box1">
			<table cellpadding="0" cellspacing="0" class="module_form" width="100%">
			<input type="hidden" id="sellid" value="{$detail.id}" />
				<tr>
					<th class="center">计次项目</th>
					<td class="left">{$detail.title}</td>
				</tr>
				<tr>
					<th class="center">剩余次数</th>
					<td class="left" id="sycs">{$detail.remain}</td>
				</tr>
				<tr>
					<th class="center">操作</th>
					<td class="left">
						<div class="number">
							扣除次数：
							<ul class="count">
								<li date-id="1" class="productnum minus">-</li>
								<li name="num" id="num" class="num">1</li>
								<li date-id="2" class="productnum plus">+</li>
							</ul>
						</div>
					</td>
				</tr>
				<tr>
					<th class="center"><label for="beizhu">备注</label></th>
					<td class="left">
						<textarea id="content">{$detail.content}</textarea>
					</td>
				</tr>
			</table>
		</div>
		<div class="xiaofei">
			<a class="form_ele_submit">确定</a>
		</div>
	</div>
</body>
<script type="text/javascript">
$(function(){
	
	//修改数量
	$('.productnum').live('click',function(){
		var id    = $(this).attr("date-id");
		var num   = parseInt($("#num").html());
		var syNum = parseInt($("#sycs").html());
		if(id==1){
			num = num>1?num-1:num
		}else{
			if(syNum<=num){
				windowApi.lhgdialog.alert('没有足够多的次数了！');
			}else{
				num = num+1
			}
			
		}
		$("#num").html(num);
	});
	
	//数据提交
	$(".form_ele_submit").on("click",function(){
		var id      = $("#sellid").val();
		var num     = $("#num").html();
		var content = $("#content").val();
		
		$.get("{:U('Sell/sellNumExpense')}",{id:id,num:num,content:content},function(d){
			frameApi.close(); //关闭当前窗口
			if(d.status==1){
				windowApi.lhgdialog.alert('消费成功！');
			}
			if(d.status==-1){
				windowApi.lhgdialog.alert(d.info);
			}
		});
	});
	
});
	
	
	
	
</script>
</html>
